package com.wanmait.baohan.listener;


import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;


/**
 * 监听器
 */
@WebListener
public class initListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("执行了监听器");
        WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
        sce.getServletContext().setAttribute("travelApplicationNumbering",1);
        sce.getServletContext().setAttribute("carApplicationNumbering",1);
        sce.getServletContext().setAttribute("hotelApplicationNumbering",1);
        sce.getServletContext().setAttribute("ticketApplicationNumbering",1);
//        Xx xx = applicationContext.getBean();
//        Map<, > map = xxService.xx();
//        sce.getServletContext().setAttribute();

    }
}
